package com.google.code.swingonfire.border;

import java.awt.Color;

public class ShadowBorderCacheKey
{
    private final int size;
    private final Color innerColor;
    private final Color outerColor;

    public ShadowBorderCacheKey(int size, Color innerColor, Color outerColor)
    {
        super();

        this.size = size;
        this.innerColor = innerColor;
        this.outerColor = outerColor;
    }

    public int getSize()
    {
        return size;
    }

    public Color getInnerColor()
    {
        return innerColor;
    }

    public Color getOuterColor()
    {
        return outerColor;
    }

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;

        result = (prime * result) + size;
        result = (prime * result) + innerColor.hashCode();
        result = (prime * result) + outerColor.hashCode();

        return result;
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
        {
            return true;
        }

        if (obj == null)
        {
            return false;
        }

        if (getClass() != obj.getClass())
        {
            return false;
        }

        ShadowBorderCacheKey other = (ShadowBorderCacheKey) obj;

        if (size != other.size)
        {
            return false;
        }

        if (!innerColor.equals(other.innerColor))
        {
            return false;
        }

        if (!outerColor.equals(other.outerColor))
        {
            return false;
        }

        return true;
    }

}
